package com.lsl.abstract_factory.example2;

import com.lsl.abstract_factory.example2.factory.ElfKingdomFactory;
import com.lsl.abstract_factory.example2.factory.KingdomFactory;
import com.lsl.abstract_factory.example2.factory.OrcKingdomFactory;
import com.lsl.abstract_factory.example2.product.army.Army;
import com.lsl.abstract_factory.example2.product.castle.Castle;
import com.lsl.abstract_factory.example2.product.king.King;
import lombok.Getter;
import lombok.Setter;

/**
 * @author Zed
 * @description
 * @date 2023/1/8 22:40
 */
@Getter
@Setter
public class Kingdom {
    private King king;
    private Castle castle;
    private Army army;


    public static class FactoryMaker {
        public enum KingdomType {
            ELF, ORC
        }

        public static KingdomFactory makeFactory(KingdomType type) {
            switch (type) {
                case ELF:
                    return new ElfKingdomFactory();
                case ORC:
                    return new OrcKingdomFactory();
                default:
                    throw new IllegalArgumentException("KingdomType not supported.");
            }
        }
    }
}
